/**
 * @(#) EquipmentCategory.java
 */

package cn.edu.sjtu.se.dslab.component.data;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "equipment_category")
public class EquipmentCategory implements Serializable {

	private static final long serialVersionUID = -4967111142785010436L;

	private long id;
	
	private String type;
	
	private String description;
	
	private Set<EquipmentProperty> properties;
	
	private boolean deleted;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}
	
	@Column(name = "description", nullable = true)
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "type", nullable = false)
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	@OneToMany(cascade = { CascadeType.ALL }, mappedBy = "category", fetch = FetchType.EAGER)
	public Set<EquipmentProperty> getProperties() {
		return properties;
	}

	public void setProperties(Set<EquipmentProperty> properties) {
		this.properties = properties;
	}
	@Column(name = "deleted", nullable = true)
	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}
}
